//
//  ValidationTicketViewController.m
//  PeopleStreet
//
//  Created by 辰领科技 on 16/6/6.
//  Copyright © 2016年 yuf. All rights reserved.
//

#import "ValidationTicketViewController.h"
#import "ValidationTicketTableViewCell.h"

static NSString * cellIndentifier = @"ValidationTicketTableViewCell";

@interface ValidationTicketViewController ()
<UITableViewDelegate,UITableViewDataSource>

@property (strong, nonatomic) IBOutlet UIView *navView;
@property (strong, nonatomic) IBOutlet UITableView *tableView;
@property (strong, nonatomic) IBOutlet UILabel *numberLabel;
@property (strong, nonatomic) IBOutlet UILabel *timeLabel;
@property (strong, nonatomic) IBOutlet UIButton *BGbutton;
@property (strong, nonatomic) IBOutlet UIView *payView;
@property (strong, nonatomic) IBOutlet UITextField *payField;
@property (strong, nonatomic) IBOutlet UIButton *leftButton;
@property (strong, nonatomic) IBOutlet UIButton *rightButton;

@end

@implementation ValidationTicketViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initViewLayout];
}


- (void)initViewLayout{
    [self adaptiveViewLayout:self.view];
    [self adaptiveViewLayout:self.navView];
    [self adaptiveViewLayout:self.payView];
    
    [self.tableView registerNib:[UINib nibWithNibName:cellIndentifier bundle:nil] forCellReuseIdentifier:cellIndentifier];
    
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    
    _payView.layer.cornerRadius = 5*VerticalRatio();
    _leftButton.layer.masksToBounds = YES;
    _leftButton.layer.cornerRadius = 20*VerticalRatio();
    _rightButton.layer.masksToBounds = YES;
    _rightButton.layer.cornerRadius = 20*VerticalRatio();
    
    [self.payField setValue:[UIColor colorWithWhite:0.604 alpha:1.000]
                  forKeyPath:@"_placeholderLabel.textColor"];
    self.payField .leftView = [[UIView alloc]initWithFrame:flexibleFrame(CGRectMake(0, 0, 15, 1), NO)];
}


- (IBAction)leftButton:(id)sender {
}
- (IBAction)rightButton:(id)sender {
}


#pragma mark - 返回
- (IBAction)back:(id)sender {
    [self.navigationController  popViewControllerAnimated:YES];
}
#pragma mark - <UITableViewDelegate && UITableViewDataSource>
//定义 UITableView cell 的个数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {;
    return 10;
}

//定义 UITableView cell 的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 64*VerticalRatio();
}

//定义 UITableView cell 展示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ValidationTicketTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:cellIndentifier];
    if (cell == nil) {
        cell= [[ValidationTicketTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIndentifier];
        
    }
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    _BGbutton.hidden = NO;
    _payView.hidden = NO;
}

#pragma mark - 隐藏支付界面
- (IBAction)hidden:(id)sender {
    _BGbutton.hidden = YES;
    _payView.hidden = YES;
    _payField.text = @"";
}
#pragma mark - 确认支付
- (IBAction)pay:(id)sender {
    
}

@end
